package com.liu.common.bean;

import com.liu.common.utils.MapUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.logging.log4j.message.ReusableMessage;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;


public class Page {

    @ApiModelProperty("当前页，默认为第一页")
    int page =1;//当前页
    @ApiModelProperty("每页记录数，默认为10")
    int pageSize =10;//每页记录数
    @ApiModelProperty("企业id")
    Integer eid;

    public Integer getEid() {
        return eid;
    }

    public void setEid(Integer eid) {
        this.eid = eid;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        if(page==0)
            this.page=1;
        else
            this.page = page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if(pageSize==0)
            this.pageSize=10;
        else
            this.pageSize = pageSize;
    }

    public Map toMap(){

        Class sup=this.getClass().getSuperclass();
        //先获取父类的
        Map parentMap = MapUtils.converttoMap(this.getClass().getSuperclass(),this);
        //子类的
        Map chiledMap =  MapUtils.converttoMap(this.getClass(),this);
        parentMap.putAll(chiledMap);
        return parentMap;
    }



}
